<html>
<head><meta charset="utf-8"><title>niko digging time · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html">niko digging time</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225871649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/225871649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#225871649">(Feb 10 2021 at 17:01)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="216206">@lcnr</span> would you be around <time datetime="2021-02-12T15:00:00Z">2021-02-12T10:00:00-05:00</time> if I used that time to dig into the compiler a bit around const generics?</p>



<a name="225871805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/225871805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#225871805">(Feb 10 2021 at 17:02)</a>:</h4>
<p>yeah</p>



<a name="226152763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226152763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226152763">(Feb 12 2021 at 15:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> do you still intend to do this today?</p>



<a name="226152806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226152806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226152806">(Feb 12 2021 at 15:39)</a>:</h4>
<p>I do except that I triple booked myself</p>



<a name="226152817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226152817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226152817">(Feb 12 2021 at 15:39)</a>:</h4>
<p>I should've pinged you, sorry</p>



<a name="226152831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226152831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226152831">(Feb 12 2021 at 15:39)</a>:</h4>
<p>are you around a bit later on? e.g., in ~20 minutes</p>



<a name="226153105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226153105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226153105">(Feb 12 2021 at 15:40)</a>:</h4>
<p>yeah, will be there</p>



<a name="226168852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226168852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226168852">(Feb 12 2021 at 17:29)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> ok, I'm way late, but I'm finally reading some code</p>



<a name="226168872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226168872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226168872">(Feb 12 2021 at 17:29)</a>:</h4>
<p>I decided to try and understand <code>WithOptConstParam</code> more closely</p>



<a name="226168913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226168913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226168913">(Feb 12 2021 at 17:30)</a>:</h4>
<p>in particular, I'm looking at <a href="https://github.com/nikomatsakis/rust/blob/a118ee2c13cc96ceb27bd5030c1cca1052377604/compiler/rustc_middle/src/ty/mod.rs#L1606-L1610">this comment</a></p>



<a name="226168968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226168968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226168968">(Feb 12 2021 at 17:30)</a>:</h4>
<p>remind me-- for anonymous constants--</p>



<a name="226169023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169023">(Feb 12 2021 at 17:31)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="226169078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169078">(Feb 12 2021 at 17:31)</a>:</h4>
<p>well, ok, so they can't access any of the <em>variables</em> from the surrounding context</p>



<a name="226169098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169098">(Feb 12 2021 at 17:31)</a>:</h4>
<p>there is an expected type</p>



<a name="226169165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169165">(Feb 12 2021 at 17:31)</a>:</h4>
<p>did you have some plan to type check anonymous constants together with their enclosing method?</p>



<a name="226169169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169169">(Feb 12 2021 at 17:31)</a>:</h4>
<p>or did I dream that</p>



<a name="226169238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169238">(Feb 12 2021 at 17:32)</a>:</h4>
<p>yesno</p>



<a name="226169269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169269">(Feb 12 2021 at 17:32)</a>:</h4>
<p>i want to typeck inline consts together with their body</p>



<a name="226169319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169319">(Feb 12 2021 at 17:32)</a>:</h4>
<p>i think that for anonymous constants the current unidirectional inference is good enough</p>



<a name="226169427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169427">(Feb 12 2021 at 17:33)</a>:</h4>
<p>and typechecking them together with their enclosing method won't work for anon consts anyways</p>



<a name="226169439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169439">(Feb 12 2021 at 17:33)</a>:</h4>
<p>cause they can be inside of binders</p>



<a name="226169458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169458">(Feb 12 2021 at 17:33)</a>:</h4>
<p>what is an inline constant</p>



<a name="226169468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169468">(Feb 12 2021 at 17:33)</a>:</h4>
<p><code>const { expr }</code></p>



<a name="226169480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169480">(Feb 12 2021 at 17:33)</a>:</h4>
<p>const blocks</p>



<a name="226169512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169512">(Feb 12 2021 at 17:33)</a>:</h4>
<p>why do you want to type check together?</p>



<a name="226169521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169521">(Feb 12 2021 at 17:34)</a>:</h4>
<p>and what is an <em>anonymous</em> constant</p>



<a name="226169749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169749">(Feb 12 2021 at 17:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/260443-project-const-generics/topic/niko.20digging.20time/near/226169439">said</a>:</p>
<blockquote>
<p>cause they can be inside of binders</p>
</blockquote>
<p>example</p>



<a name="226169757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169757">(Feb 12 2021 at 17:35)</a>:</h4>
<p>remember that <a href="https://hackmd.io/9LIywezOQj-h5HX8vvEnSw#inline-consts">https://hackmd.io/9LIywezOQj-h5HX8vvEnSw#inline-consts</a></p>



<a name="226169763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169763">(Feb 12 2021 at 17:35)</a>:</h4>
<p>and why does that not apply to <code>const { expr }</code>?</p>



<a name="226169799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169799">(Feb 12 2021 at 17:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/260443-project-const-generics/topic/niko.20digging.20time/near/226169749">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/260443-project-const-generics/topic/niko.20digging.20time/near/226169439">said</a>:</p>
<blockquote>
<p>cause they can be inside of binders</p>
</blockquote>
<p>example</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/pull/79313">https://github.com/rust-lang/rust/pull/79313</a></p>



<a name="226169877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169877">(Feb 12 2021 at 17:36)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(const_generics)]</span><span class="w"></span>
<span class="cp">#![allow(incomplete_features)]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">T</span><span class="p">)</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="n">T</span><span class="p">;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="na">a</span> <span class="p">();</span><span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="p">}]</span>: <span class="nb">Sized</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="226169893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169893">(Feb 12 2021 at 17:36)</a>:</h4>
<p>ok, so, the difference is that a <code>const { }</code> expression is a <em>value</em></p>



<a name="226169912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169912">(Feb 12 2021 at 17:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/260443-project-const-generics/topic/niko.20digging.20time/near/226169893">said</a>:</p>
<blockquote>
<p>ok, so, the difference is that a <code>const { }</code> expression is a <em>value</em></p>
</blockquote>
<p>or a pattern</p>



<a name="226169914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169914">(Feb 12 2021 at 17:36)</a>:</h4>
<p>but an anonymous constant is part of a type or some expression?</p>



<a name="226169958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226169958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226169958">(Feb 12 2021 at 17:36)</a>:</h4>
<p>e.g., if I have <code>[x; 32]</code>, that <code>32</code> is an anonymous constant, right?</p>



<a name="226170009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170009">(Feb 12 2021 at 17:37)</a>:</h4>
<p>anonymous constants (or at least how i use it) are array/repeat expr lengths and const arguments</p>



<a name="226170070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170070">(Feb 12 2021 at 17:37)</a>:</h4>
<p>ok. const arguments feel like an expression too</p>



<a name="226170095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170095">(Feb 12 2021 at 17:37)</a>:</h4>
<p>I mean they all are</p>



<a name="226170130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170130">(Feb 12 2021 at 17:38)</a>:</h4>
<p>I'm not sure I agree there's a meaningful distinction</p>



<a name="226170167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170167">(Feb 12 2021 at 17:38)</a>:</h4>
<p><del>all constants are expressions</del>(that message is bogus)</p>



<a name="226170193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170193">(Feb 12 2021 at 17:38)</a>:</h4>
<p>but const blocks can only occur as expressions and patterns</p>



<a name="226170222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170222">(Feb 12 2021 at 17:38)</a>:</h4>
<p>anonymous constants can also occur inside of types and cannot be expressions by themselves</p>



<a name="226170347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/niko%20digging%20time/near/226170347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/niko.20digging.20time.html#226170347">(Feb 12 2021 at 17:39)</a>:</h4>
<p>the example for inline consts from the hackmd is</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nc">Foo</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="n">foo</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="p">});</span><span class="w"></span>
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>